<?php 
session_start();          
	require_once "../includes/config.php";
	
	$fid=$_REQUEST['fid'];
	$sqlSelMsg="select * from tbl_messages where messageid=$fid";
	$rstSelMsg=mysql_query($sqlSelMsg);
	$rowSelMsg=mysql_fetch_array($rstSelMsg);
	
    $subject=stripslashes($rowSelMsg['subject']);
    $message=stripslashes($rowSelMsg['message']);
    $post_date=$rowSelMsg['posteddate'];
    $selUser=mysql_query("select * from tbl_users where user_id='".$rowSelMsg['senderid']."'");
    $rowUser=mysql_fetch_array($selUser);
    $selUser2=mysql_query("select * from tbl_users where user_id='".$rowSelMsg['recieverid']."'");
    $rowUser2=mysql_fetch_array($selUser2);
    $sender=$rowUser['username'];
    $receiver=$rowUser2['username'];
	
    $selProduct=mysql_query("select * from tbl_product where product_id='".$rowSelMsg['productid']."'");
    $rowProduct=mysql_fetch_array($selProduct);
	$productname=$rowProduct['product_name'];
?>
<style type="text/css">
	table#tbl-profile tr td { vertical-align:middle; }
</style>
<table width="100%" height="611"  border="1" cellspacing="0" class='container'>
  <tr>
  	<td height="26" class="tdHeader">View Message </td>
  </tr>
  <tr>
    <td><table id="tbl-profile" width="80%" align="center"  border="0" cellspacing="0" cellpadding="0">
      
	  	  
      <tr>
        <td width="37" bgcolor="#FBF1F1">&nbsp;</td>
        <td width="215" height="33" bgcolor="#FBF1F1">Subject </td>
        <td width="380" height="33" bgcolor="#FBF1F1"><?php echo $subject; ?></td>
      </tr>
      
      <tr>
        <td width="37" >&nbsp;</td>
        <td width="215" height="33">Message  </td>
        <td width="380" height="33"><?php echo $message; ?></td>
      </tr>
      
      <tr>
        <td width="37" bgcolor="#FBF1F1">&nbsp;</td>
        <td width="215" height="33" bgcolor="#FBF1F1">Sender</td>
        <td width="380" height="33" bgcolor="#FBF1F1"><?php echo $sender; ?></td>
      </tr>
      
      <tr>
        <td width="37" >&nbsp;</td>
        <td width="215" height="33">Receiver</td>
        <td width="380" height="33"><?php echo $receiver; ?></td>
      </tr>
      
      <tr>
        <td width="37" bgcolor="#FBF1F1">&nbsp;</td>
        <td width="215" height="33" bgcolor="#FBF1F1">Product</td>
        <td width="380" height="33" bgcolor="#FBF1F1"><?php echo $productname; ?></td>
      </tr>
      
       <tr>
        <td width="37" >&nbsp;</td>
        <td width="215" height="33">Post Date</td>
        <td width="380" height="33"><?php echo $post_date; ?></td>
      </tr>
      
	 
     <tr>
	 	<td>&nbsp;</td>
        <td height="98" colspan="2"><a href="index.php?mem_messages">Back To List</a></td>
     </tr>
    </table></td>
  </tr>
</table>
